#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Mysoft.App/Mysoft.App.csproj", "Mysoft.App/"]
COPY ["Mysoft.AppStartup/Mysoft.AppStartup.csproj", "Mysoft.AppStartup/"]
COPY ["Mysoft.Domain/Mysoft.Domain.csproj", "Mysoft.Domain/"]
COPY ["Mysoft.Entity/Mysoft.Entity.csproj", "Mysoft.Entity/"]
COPY ["Mysoft.Data/Mysoft.Data.csproj", "Mysoft.Data/"]
COPY ["Mysoft.Common/Mysoft.Common.csproj", "Mysoft.Common/"]
COPY ["Mysoft.Dto/Mysoft.Dto.csproj", "Mysoft.Dto/"]
COPY ["Mysoft.Tasks/Mysoft.Tasks.csproj", "Mysoft.Tasks/"]
RUN dotnet restore "Mysoft.App/Mysoft.App.csproj"
COPY . .
WORKDIR "/src/Mysoft.App"
RUN dotnet build "Mysoft.App.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Mysoft.App.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Mysoft.App.dll"]